<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        #list li {
            line-height: 30px;
        }
        
        #pagecut {
            display: flex;
            justify-content: center;
            align-items: center;
        }
        
        span {
            padding: 0 5px;
        }
        
        .page {
            display: flex;
            justify-content: center;
            align-items: center;
        }
        
        .select {
            width: 100px;
        }
        
        .page li {
            list-style: none;
            padding: 0 10px;
            border: 1px solid #ccc;
        }
    </style>
</head>

<body>
    <ul id="list">
        <!-- <li>1</li>
        <li>2</li>
        <li>3</li>
        <li>1</li>
        <li>2</li>
        <li>3</li> -->
    </ul>
    <div id="pagecut">
        <span>上一页</span>
        <select class="select">
            <!-- <option value="1">1</option>
            <option value="2">2</option> -->
        </select>
        <ol class="page">
            <!-- <li>1</li>
            <li>2</li>
            <li>3</li> -->
        </ol>
        <span>下一页</span>
    </div>

    <script src="./page_cut.js"></script>
    <script>
        var obj = new cutPage({
            el: document.getElementById("pagecut"), //类挂载的元素
            data: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13], //总数据
            pageLength: [2, 5, 10, 15], //每页显示的数据条数；（select框显示的数据）

            //select框中的每页展示条数改变时触发，获取到当前选择的每页显示的条数
            cb1: function(data) {
                console.log(data)
            },
            //页码改变时触发，接受到当前页的数据
            cb2: function(data) {
                console.log(data)
                var html = ""
                data.forEach(function(i) {
                    html += `<li>${i}</li>`
                });
                list.innerHTML = html

            }
        })
    </script>
</body>

</html>